package l1j.opqlo.NewSystem;

import java.util.HashMap;
import l1j.server.server.model.L1Party;

//opqlo 斷線重登會自動加入原本隊伍
public class TeamLog {
	private static TeamLog _instance;

	private static final HashMap<Integer, L1Party> _PartyList = new HashMap<Integer, L1Party>();

	public static TeamLog getInstance() {
		if (_instance == null) {
			_instance = new TeamLog();
		}
		return _instance;
	}

	public void AddPartyList(final int partyid, final L1Party party) {
		_PartyList.put(partyid, party);
	}

	public void ChangeLeader(final int srcpartyid, final int newpartyid,
			final L1Party party) {
		_PartyList.remove(srcpartyid);
		_PartyList.put(newpartyid, party);
	}

	/**
	 * opqlo 斷線重登會自動加入原本隊伍 依照隊伍編號取回L1Party物件
	 *
	 * @return L1Party
	 */
	public L1Party getPartyList(final int partyid) {
		return _PartyList.get(partyid);
	}

	public int getTeamLogSize() {
		return _PartyList.size();
	}

	public boolean hasParty(final int partyid) {
		return _PartyList.containsKey(partyid);
	}

	public void RemovePartyList(final int partyid) {
		_PartyList.remove(partyid);
	}

}
